import $ from 'jquery'

export default function () {
  const stars = 800
  const r = 900
  const $stars = $('.stars')

  for (let i = 0; i < stars; i++) {
    if (window.CP.shouldStopExecution(1)) break
    const $star = $('<div/>').addClass('star')
    $stars.append($star)
  }

  window.CP.exitedLoop(1)
  $('.star').each(function () {
    const cur = $(this)
    const s = 0.2 + Math.random() * 1
    const curR = r + Math.random() * 300
    cur.css({
      transformOrigin: '0 0 ' + curR + 'px',
      transform: ' translate3d(0,0,-' + curR + 'px) rotateY(' + Math.random() * 360 + 'deg) rotateX(' + Math.random() * -50 + 'deg) scale(' + s + ',' + s + ')'
    })
  })
}
